package com.tsd.jxc.stock.entity;

import com.alibaba.fastjson.JSON;
import com.tsd.core.utils.DoubleUtil;
import com.tsd.core.utils.HlpUtils;
import com.tsd.core.utils.ListUtil;
import com.tsd.jxc.vo.PrintVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 盘点商品清单扩展
 *
 * @author Hillpool
 * @date 2022/07/29 15:06:33
 */
@ApiModel(description = "盘点商品清单扩展")
public class JxcStockInventoryItemExt extends JxcStockInventoryItem implements Serializable {

    private String goods_name;

    private String goods_spec;

    private String goods_model;

    @ApiModelProperty(value = "保存仓库单号")
    private String inventory_code;

    @ApiModelProperty(value = "保存仓库名称")
    private String warehouse_name;

    @ApiModelProperty(value = "保存盘点时间")
    private String check_date;

    @ApiModelProperty(value = "保存商品sid，用于更新库存")
    private String stock_goods_sid;

    private BigDecimal price;

    private String unit;

    private List<String> inventory_list;

    public String getGoods_name() {
        return goods_name;
    }

    public void setGoods_name(String goods_name) {
        this.goods_name = goods_name;
    }

    public String getInventory_code() {
        return inventory_code;
    }

    public void setInventory_code(String inventory_code) {
        this.inventory_code = inventory_code;
    }

    public String getWarehouse_name() {
        return warehouse_name;
    }

    public void setWarehouse_name(String warehouse_name) {
        this.warehouse_name = warehouse_name;
    }

    public String getCheck_date() {
        return check_date;
    }

    public void setCheck_date(String check_date) {
        this.check_date = check_date;
    }

    public String getStock_goods_sid() {
        return stock_goods_sid;
    }

    public void setStock_goods_sid(String stock_goods_sid) {
        this.stock_goods_sid = stock_goods_sid;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getGoods_spec() {
        return goods_spec;
    }

    public void setGoods_spec(String goods_spec) {
        this.goods_spec = goods_spec;
    }

    public String getGoods_model() {
        return goods_model;
    }

    public void setGoods_model(String goods_model) {
        this.goods_model = goods_model;
    }

    public List<String> getInventory_list() {
        return inventory_list;
    }

    public void setInventory_list(List<String> inventory_list) {
        this.inventory_list = inventory_list;
    }

    public PrintVo convert2Print() {
        PrintVo vo = new PrintVo();
        vo.setSn(this.getSn());
        vo.setGoods_name(this.getGoods_name());
        vo.setSpec_name(this.getGoods_spec());
        vo.setOld_qty(this.getOld_qty());
        vo.setCheck_qty(this.getCheck_qty());
        vo.setNote_info(this.getNote_info());
        return vo;
    }

    public JxcStockInbillItemExt genInBillItem() {
        JxcStockInbillItemExt itemExt = new JxcStockInbillItemExt();
        double surplus = Math.abs(this.getSurplus());
        double amount = DoubleUtil.mul(surplus, this.getPrice());
        itemExt.setGoods_sid(this.getGoods_sid());
        itemExt.setPrice(this.getPrice());
        itemExt.setIn_qty(BigDecimal.valueOf(surplus));
        itemExt.setAmount(BigDecimal.valueOf(amount));
        itemExt.setUnit_name(this.getUnit());
        itemExt.setGoods_name(this.getGoods_name());
        itemExt.setSn(this.getSn());
        return itemExt;
    }

    public JxcStockOutbillItemExt genOutBillItem() {
        JxcStockOutbillItemExt itemExt = new JxcStockOutbillItemExt();
        double surplus = Math.abs(this.getSurplus());
        double outAmount = DoubleUtil.mul(surplus, this.getPrice());
        itemExt.setGoods_sid(this.getGoods_sid());
        itemExt.setPrice(this.getPrice());
        itemExt.setOut_qty(BigDecimal.valueOf(surplus));
        itemExt.setAmount(BigDecimal.valueOf(outAmount));
        itemExt.setUnit_name(this.getUnit());
        itemExt.setGoods_name(this.getGoods_name());
        itemExt.setGoods_spec(this.getGoods_spec());
        itemExt.setGoods_model(this.getGoods_model());
        itemExt.setSn(this.getSn());
        return itemExt;
    }

}
